import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import { useUserIdStore } from './stores/UserId'

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)
app.use(router)

// 在应用启动时恢复用户登录状态
const userIdStore = useUserIdStore()
userIdStore.restoreFromStorage()

console.log('🚀 应用启动，用户状态已恢复:', {
  userId: userIdStore.currentUserId,
  isAuthenticated: userIdStore.isAuthenticated,
  operation: userIdStore.operationDetails
})

app.mount('#app')
